/*******************************************************************/
/* @ All Rights Reserved Copyright (C) 2014 broada,Co.,Ltd.        */
/*                                                                 */
/*  NAME      = frsutl.h                                           */
/*  NOTE      =                                                    */
/*  DATE      = 2014/11/10 by yaohl                                */
/*******************************************************************/

#ifndef __FRSUTL_H_
#define __FRSUTL_H_

#include <stdlib.h>

/* apm中使用uuid的数据长度 */
#define APM_UUID_SIZE  37

int  fruuid(char *p_uuid);

u_int iptools_parse_ipaddr(const char *dotted);
void iptools_parse_iprange(char* dotted, u_int* min_ip, u_int* max_ip);
void iptools_parse_portrange(char* dotted, u_short* sport, u_short* dport);
int  iptools_parse_mac(char* str_mac, unsigned char* mac, int size);
int  frget_absdir(char *p_relative_path, char *p_abs_dir, unsigned int ui_size);

int  frtime2str(struct timeval *p_tv , char *p_time, unsigned int ui_time_size);
long frtime_diff(struct timeval *p_tv_pre, struct timeval *p_tv_now);

void frprint_bin(const char *p_fun, const char *p_file, unsigned int ui_line
               , const char *p_title, const char *p_data, unsigned int ui_size);
#define FRPRINT_BIN(a,b,c) frprint_bin(__func__,__FILE__,__LINE__, a, b, c)

void frprint_l4(const char *p_fun, const char *p_file, unsigned int ui_line
                    , u_short ip_proto, u_int src_ip, u_short src_port, u_int dst_ip,u_short dst_port);
void frprint2_l4(char *p_buff, unsigned int ui_buff_size
                ,u_short ip_proto, u_int src_ip, u_short src_port, u_int dst_ip,u_short dst_port);

void frtrim(char *p_instr);
void frrtrim(char *p_instr);
void frltrim(char *p_instr);
#define FRPRINT_L4(a,b,c,d,e)  frprint_l4(__func__,__FILE__,__LINE__, a, b, c, d,e)

#endif

